﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using _1242026_1242133.DTO;

namespace _1242026_1242133.DAO
{
    class DatPhongDAO
    {
        public DataTable ThemPhieuThuePhong(DatPhongDTO DatPhongDto)
        {
            SqlSever sql = new SqlSever();
            SqlParameter[] arrParam = {   
                                          new SqlParameter("@TenKhachHang", SqlDbType.VarChar), 
                                          new SqlParameter("@CMND", SqlDbType.VarChar),
                                          new SqlParameter("@DiaChi", SqlDbType.VarChar),
                                          new SqlParameter("@MaLoaiKhach", SqlDbType.VarChar),
                                          new SqlParameter("@MaPhong", SqlDbType.VarChar),
                                          new SqlParameter("@NgayThuePhong", SqlDbType.DateTime),
                                                                                
                                      };
            arrParam[0].Value = DatPhongDto.TenKhachHang;
            arrParam[1].Value = DatPhongDto.CMND;
            arrParam[2].Value = DatPhongDto.DiaChi;
            arrParam[3].Value = DatPhongDto.MaLoaiKhach;
            arrParam[4].Value = DatPhongDto.MaPhong;
            arrParam[5].Value = DatPhongDto.NgayThuePhong;
            return sql.ExecuteStore("sp_ThemPhieuThuePhong", arrParam);
        }

        public DataTable LoadDSPhongTheoLoaiPhong(string MaLoaiPhong)
        {
            SqlSever sql = new SqlSever();
            SqlParameter [] arrParam ={ new SqlParameter("@MaLoaiPhong", SqlDbType.VarChar)};
            arrParam[0].Value = MaLoaiPhong;
            return sql.ExecuteStore("sp_LoadDSPhongTheoLoaiPhong",arrParam);
        }

        public DataTable LoadDSKhachHangDangThuePhong()
        {
            SqlSever sql = new SqlSever();
            return sql.ExecuteStore("sp_LoadDSKhachHangDangThuePhong");
        }

        public DataTable LoadDanhSachPhieuThue()
        {
            SqlSever sql = new SqlSever();
            return sql.ExecuteStore("sp_LoadPhieuThuePhong");
        }
    }
}
